function OS_Window(host,id)
{
	this.$super=OS_Resource;
	if (this.$super(host,id)===false) return;
	delete this.$super;
	
	var source=null;
	
	this.load=function(handler)
	{
		source=OS_Resource.resource.get(this.resourceNode.getElementsByTagName("source")[0].childNodes[0].nodeValue);
		this.loaded=true;
		handler();
	}
	
	this.drawSelf=function(context,left,top,width,height,flag)
	{
		if (height<16) return;
		var image=source.getImage();
		//画背景
		context.drawImage(image,0,0,64,64,left+4,top+4,width-8,height-8);
		//画四角
		context.drawImage(image,64,0,8,8,left,top,8,8);
		context.drawImage(image,120,0,8,8,left+width-8,top,8,8);
		context.drawImage(image,64,56,8,8,left,top+height-8,8,8);
		context.drawImage(image,120,56,8,8,left+width-8,top+height-8,8,8);
		//画边
		context.drawImage(image,72,0,8,8,left+8,top,width-16,8);
		context.drawImage(image,64,8,8,8,left,top+8,8,height-16);
		context.drawImage(image,72,56,8,8,left+8,top+height-8,width-16,8);
		context.drawImage(image,120,48,8,8,left+width-8,top+8,8,height-16);
		//画确认键
		if (flag>0)
		{
			var sleft=0;
			var stop=0;
			var tleft=left+width-32;
			var ttop=top+height-20;
			if (flag==1||flag==8){sleft=96;stop=64;}
			if (flag==2||flag==7){sleft=112;stop=64;}
			if (flag==3||flag==6){sleft=112;stop=80;}
			if (flag==4||flag==5){sleft=96;stop=80;}
			context.drawImage(image,sleft,stop,16,16,tleft,ttop,16,16);
		}
	}
}

OS_Resource.Builder.put("window",OS_Window);